// 定点巡更
import { req } from '@/utils/request'

// 巡更点
export const getSpot = data => req.get('/cq/cqPatrolSpot/list', data)
export const addSpot = data => req.post('/cq/cqPatrolSpot/add', data)
export const setSpot = data => req.post('/cq/cqPatrolSpot/edit', data)
export const delSpot = patSpotId => req.get(`/cq/cqPatrolSpot/delete?patSpotId=${patSpotId}`)
export const setSpotStatus = data => req.get('/cq/cqPatrolSpot/enable', data)
export const importSpot = (data, opts) => req.post('/cq/cqPatrolSpot/importSpot', data, opts)

// 负责人
export const getSpotBuilder = data => req.get('/cq/cqPatrolSpotBuilder/list', data)
export const addSpotBuilder = data => req.post('/cq/cqPatrolSpotBuilder/add', data)
export const setSpotBuilder = data => req.post('/cq/cqPatrolSpotBuilder/edit', data)
export const delSpotBuilder = spotBuilderId => req.get(`/cq/cqPatrolSpotBuilder/delete?spotBuilderId=${spotBuilderId}`)
export const verifyBuilder = data => req.get('/cq/cqPatrolSpotBuilder/verify', data)
// 负责人变更记录
export const getSpotBuilderChange = data => req.get('/cq/cqPatrolSpotBuilderChange/list', data)

// 巡更路线(废弃)
export const getRoute = data => req.get('/cq/patrol/route', data)
export const addRoute = data => req.post('/cq/patrol/route/add', data)
export const setRoute = data => req.post('/cq/patrol/route/set', data)
export const removeRoute = data => req.post('/cq/patrol/route/remove', data)
// 巡更路线点位
export const getRouteSpot = data => req.get('/cq/patrol/route/spot', data)
export const addRouteSpot = data => req.post('/cq/patrol/route/spot/add', data)
export const setRouteSpot = data => req.post('/cq/patrol/route/spot/set', data)
export const removeRouteSpot = data => req.post('/cq/patrol/route/spot/remove', data)

// 巡更计划
export const getPlan = data => req.get('/cq/cqPatrolPlan/list', data)
export const addPlan = data => req.post('/cq/cqPatrolPlan/add', data)
export const setPlan = data => req.post('/cq/cqPatrolPlan/edit', data)
export const delPlan = patPlanId => req.get(`/cq/cqPatrolPlan/delete?patPlanId=${patPlanId}`)
export const setPlanStatus = data => req.get('/cq/cqPatrolPlan/enable', data)
export const generateTask = data => req.get('/cq/cqPatrolPlan/generateTask', data)

// 计划点位
export const getPlanSpot = data => req.get('/cq/cqPatrolPlanSpot/list', data)
export const addPlanSpot = data => req.post('/cq/cqPatrolPlanSpot/add', data)
export const setPlanSpot = data => req.post('/cq/cqPatrolPlanSpot/edit', data)
export const delPlanSpot = planSpotId => req.get(`/cq/cqPatrolPlanSpot/delete?planSpotId=${planSpotId}`)
export const saveBatchPlanSpot = data => req.post('/cq/cqPatrolPlanSpot/saveBatch', data)

// 巡更任务
export const getTask = data => req.get('/cq/cqPatrolTask/list', data)
export const addTask = data => req.post('/cq/cqPatrolTask/add', data)
export const setTask = data => req.post('/cq/cqPatrolTask/edit', data)
export const setTaskStatus = data => req.get('/cq/cqPatrolTask/enable', data)
// 任务详情
export const getTaskByTaskId = data => req.get('/cq/cqPatrolTask/getTaskByTaskId', data)
// 任务转派
export const taskTurnSend = data => req.post('/cq/cqPatrolTask/turn_send', data)
// 任务路线
export const getTaskRoutes = data => req.post('/cq/cqPatrolTask/getTaskRoutes', data)

// 任务点位
export const getTaskSpot = data => req.get('/cq/cqPatrolTaskSpot/list', data)
export const addTaskSpot = data => req.post('/cq/cqPatrolTaskSpot/add', data)
export const setTaskSpot = data => req.post('/cq/cqPatrolTaskSpot/edit', data)
export const delTaskSpot = data => req.post(`/cq/cqPatrolTaskSpot/delete`, data)
export const setTaskSpotStatus = data => req.get('/cq/cqPatrolTaskSpot/enable', data)
export const saveBatchTaskSpot = data => req.post('/cq/cqPatrolTaskSpot/saveBatch', data)

// 巡更类型
export const listPatType = data => req.get('/cq/cqPatrolType/list', data)
export const addPatType = data => req.post('/cq/cqPatrolType/add', data)
export const setPatType = data => req.post('/cq/cqPatrolType/edit', data)
export const delPatType = patrolTypeId => req.post(`/cq/cqPatrolType/delete?patrolTypeId=${patrolTypeId}`)

// 检查标准
export const listPatStandard = data => req.get('/cq/cqPatrolStandard/standardlist', data)
export const addPatStandard = data => req.post('/cq/cqPatrolStandard/add', data)
export const setPatStandard = data => req.post('/cq/cqPatrolStandard/edit', data)
export const delPatStandard = standardId => req.post(`/cq/cqPatrolStandard/delete?standardId=${standardId}`)

// 项目平面图
export const listPatProFile = data => req.get('/cq/cqPatrolProFile/list', data)
export const addPatProFile = data => req.post('/cq/cqPatrolProFile/add', data)
export const setPatProFile = data => req.post('/cq/cqPatrolProFile/edit', data)
export const delPatProFile = patProFileId => req.post(`/cq/cqPatrolProFile/delete?patProFileId=${patProFileId}`)

// 巡更配置
export const listPatCfg = data => req.get('/cq/cqPatrolCfg/list', data)
export const addPatCfg = data => req.post('/cq/cqPatrolCfg/add', data)
export const setPatCfg = data => req.post('/cq/cqPatrolCfg/edit', data)
export const delPatCfg = patCfgId => req.post(`/cq/cqPatrolCfg/delete/${patCfgId}`)
